//class for input... supports keyboard and mouse input

#ifndef _HELIX_INPUT_H_
#define _HELIX_INPUT_H_

#include "Helix.h"
#include "HObject.h"

namespace helix		//Put this in the helix namespace
{

	#define H_LEFT_MOUSE_BUTTON 0x01
	#define H_RIGHT_MOUSE_BUTTON 0x02
	#define H_MIDDLE_MOUSE_BUTTON 0x04

	#define H_ESCAPE          0x01
	#define H_1               0x02
	#define H_2               0x03
	#define H_3               0x04
	#define H_4               0x05
	#define H_5               0x06
	#define H_6               0x07
	#define H_7               0x08
	#define H_8               0x09
	#define H_9               0x0A
	#define H_0               0x0B
	#define H_MINUS           0x0C    /* - on main keyboard */
	#define H_EQUALS          0x0D
	#define H_BACK            0x0E    /* backspace */
	#define H_TAB             0x0F
	#define H_Q               0x10
	#define H_W               0x11
	#define H_E               0x12
	#define H_R               0x13
	#define H_T               0x14
	#define H_Y               0x15
	#define H_U               0x16
	#define H_I               0x17
	#define H_O               0x18
	#define H_P               0x19
	#define H_LBRACKET        0x1A
	#define H_RBRACKET        0x1B
	#define H_RETURN          0x1C    /* Enter on main keyboard */
	#define H_LCONTROL        0x1D
	#define H_A               0x1E
	#define H_S               0x1F
	#define H_D               0x20
	#define H_F               0x21
	#define H_G               0x22
	#define H_H               0x23
	#define H_J               0x24
	#define H_K               0x25
	#define H_L               0x26
	#define H_SEMICOLON       0x27
	#define H_APOSTROPHE      0x28
	#define H_GRAVE           0x29    /* accent grave */
	#define H_LSHIFT          0x2A
	#define H_BACKSLASH       0x2B
	#define H_Z               0x2C
	#define H_X               0x2D
	#define H_C               0x2E
	#define H_V               0x2F
	#define H_B               0x30
	#define H_N               0x31
	#define H_M               0x32
	#define H_COMMA           0x33
	#define H_PERIOD          0x34    /* . on main keyboard */
	#define H_SLASH           0x35    /* / on main keyboard */
	#define H_RSHIFT          0x36
	#define H_MULTIPLY        0x37    /* * on numeric keypad */
	#define H_LMENU           0x38    /* left Alt */
	#define H_SPACE           0x39
	#define H_CAPITAL         0x3A
	#define H_F1              0x3B
	#define H_F2              0x3C
	#define H_F3              0x3D
	#define H_F4              0x3E
	#define H_F5              0x3F
	#define H_F6              0x40
	#define H_F7              0x41
	#define H_F8              0x42
	#define H_F9              0x43
	#define H_F10             0x44
	#define H_NUMLOCK         0x45
	#define H_SCROLL          0x46    /* Scroll Lock */
	#define H_NUMPAD7         0x47
	#define H_NUMPAD8         0x48
	#define H_NUMPAD9         0x49
	#define H_SUBTRACT        0x4A    /* - on numeric keypad */
	#define H_NUMPAD4         0x4B
	#define H_NUMPAD5         0x4C
	#define H_NUMPAD6         0x4D
	#define H_ADD             0x4E    /* + on numeric keypad */
	#define H_NUMPAD1         0x4F
	#define H_NUMPAD2         0x50
	#define H_NUMPAD3         0x51
	#define H_NUMPAD0         0x52
	#define H_DECIMAL         0x53    /* . on numeric keypad */
	#define H_OEM_102         0x56    /* <> or \| on RT 102-key keyboard (Non-U.S.) */
	#define H_F11             0x57
	#define H_F12             0x58
	#define H_F13             0x64    /*                     (NEC PC98) */
	#define H_F14             0x65    /*                     (NEC PC98) */
	#define H_F15             0x66    /*                     (NEC PC98) */
	#define H_KANA            0x70    /* (Japanese keyboard)            */
	#define H_ABNT_C1         0x73    /* /? on Brazilian keyboard */
	#define H_CONVERT         0x79    /* (Japanese keyboard)            */
	#define H_NOCONVERT       0x7B    /* (Japanese keyboard)            */
	#define H_YEN             0x7D    /* (Japanese keyboard)            */
	#define H_ABNT_C2         0x7E    /* Numpad . on Brazilian keyboard */
	#define H_NUMPADEQUALS    0x8D    /* = on numeric keypad (NEC PC98) */
	#define H_PREVTRACK       0x90    /* Previous Track (H_CIRCUMFLEX on Japanese keyboard) */
	#define H_AT              0x91    /*                     (NEC PC98) */
	#define H_COLON           0x92    /*                     (NEC PC98) */
	#define H_UNDERLINE       0x93    /*                     (NEC PC98) */
	#define H_KANJI           0x94    /* (Japanese keyboard)            */
	#define H_STOP            0x95    /*                     (NEC PC98) */
	#define H_AX              0x96    /*                     (Japan AX) */
	#define H_UNLABELED       0x97    /*                        (J3100) */
	#define H_NEXTTRACK       0x99    /* Next Track */
	#define H_NUMPADENTER     0x9C    /* Enter on numeric keypad */
	#define H_RCONTROL        0x9D
	#define H_MUTE            0xA0    /* Mute */
	#define H_CALCULATOR      0xA1    /* Calculator */
	#define H_PLAYPAUSE       0xA2    /* Play / Pause */
	#define H_MEDIASTOP       0xA4    /* Media Stop */
	#define H_VOLUMEDOWN      0xAE    /* Volume - */
	#define H_VOLUMEUP        0xB0    /* Volume + */
	#define H_WEBHOME         0xB2    /* Web home */
	#define H_NUMPADCOMMA     0xB3    /* , on numeric keypad (NEC PC98) */
	#define H_DIVIDE          0xB5    /* / on numeric keypad */
	#define H_SYSRQ           0xB7
	#define H_RMENU           0xB8    /* right Alt */
	#define H_PAUSE           0xC5    /* Pause */
	#define H_HOME            0xC7    /* Home on arrow keypad */
	#define H_UP              0xC8    /* UpArrow on arrow keypad */
	#define H_PRIOR           0xC9    /* PgUp on arrow keypad */
	#define H_LEFT            0xCB    /* LeftArrow on arrow keypad */
	#define H_RIGHT           0xCD    /* RightArrow on arrow keypad */
	#define H_END             0xCF    /* End on arrow keypad */
	#define H_DOWN            0xD0    /* DownArrow on arrow keypad */
	#define H_NEXT            0xD1    /* PgDn on arrow keypad */
	#define H_INSERT          0xD2    /* Insert on arrow keypad */
	#define H_DELETE          0xD3    /* Delete on arrow keypad */
	#define H_LWIN            0xDB    /* Left Windows key */
	#define H_RWIN            0xDC    /* Right Windows key */
	#define H_APPS            0xDD    /* AppMenu key */
	#define H_POWER           0xDE    /* System Power */
	#define H_SLEEP           0xDF    /* System Sleep */
	#define H_WAKE            0xE3    /* System Wake */
	#define H_WEBSEARCH       0xE5    /* Web Search */
	#define H_WEBFAVORITES    0xE6    /* Web Favorites */
	#define H_WEBREFRESH      0xE7    /* Web Refresh */
	#define H_WEBSTOP         0xE8    /* Web Stop */
	#define H_WEBFORWARD      0xE9    /* Web Forward */
	#define H_WEBBACK         0xEA    /* Web Back */
	#define H_MYCOMPUTER      0xEB    /* My Computer */
	#define H_MAIL            0xEC    /* Mail */
	#define H_MEDIASELECT     0xED    /* Media Select */

	/*
	*  Alternate names for keys, to facilitate transition from DOS.
	*/
	#define H_BACKSPACE       H_BACK            /* backspace */
	#define H_NUMPADSTAR      H_MULTIPLY        /* * on numeric keypad */
	#define H_LALT            H_LMENU           /* left Alt */
	#define H_CAPSLOCK        H_CAPITAL         /* CapsLock */
	#define H_NUMPADMINUS     H_SUBTRACT        /* - on numeric keypad */
	#define H_NUMPADPLUS      H_ADD             /* + on numeric keypad */
	#define H_NUMPADPERIOD    H_DECIMAL         /* . on numeric keypad */
	#define H_NUMPADSLASH     H_DIVIDE          /* / on numeric keypad */
	#define H_RALT            H_RMENU           /* right Alt */
	#define H_UPARROW         H_UP              /* UpArrow on arrow keypad */
	#define H_PGUP            H_PRIOR           /* PgUp on arrow keypad */
	#define H_LEFTARROW       H_LEFT            /* LeftArrow on arrow keypad */
	#define H_RIGHTARROW      H_RIGHT           /* RightArrow on arrow keypad */
	#define H_DOWNARROW       H_DOWN            /* DownArrow on arrow keypad */
	#define H_PGDN            H_NEXT            /* PgDn on arrow keypad */



	class MY_CLASS Input : public HObject
	{
	private:
		static const int INITIAL_CAPACITY=256;

	protected:
		unsigned char *textBuffer;		//a buffer to store user input
		int bufferLength;		//the length of the buffer
		int bufferCapacity;		//the capacity of the buffer

	public:
		Input();
		Input(int bufferSize);
		virtual ~Input();

		virtual bool keyDown(unsigned char key)=0;				//return true if the specified key is pressed
		virtual bool mouseDown(unsigned char mouseButton)=0;	//return true if the specified mouse button is pressed

		virtual bool leftMouse()=0;			//return true if the left mouse button is pressed
		virtual bool rightMouse()=0;		//return true if the right mouse button is pressed
		virtual bool middleMouse()=0;		//return true if the middle mouse button is pressed

		virtual long getMouseX()=0;			//get the current mouse position in the x direction (in pixels)
		virtual long getMouseY()=0;			//get the current mouse position in the y direction (in pixels)
		virtual long getMouseZ()=0;			//get the position of the mouse wheel 

		virtual void update()=0;			//do any kind of update that that input implementation might need per frame
	};

}  //End the helix namespace

#endif